x11: Use gdk_x11_window_foreign_new_for_display() unconditionally
authorBenjamin Otte <otte@redhat.com>
Tue, 1 Feb 2011 15:36:23 +0000 (16:36 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 1 Feb 2011 17:51:57 +0000 (18:51 +0100)
gdk_x11_window_lookup_window() calls are done by this function alreayd,
so no need to do them manually.

gdk/x11/gdkdnd-x11.c

index ee557c677f839faa2553b0b3155fcb78eac6180a..665941a6b8db28e3672fbd264151c31da934681a 100644 (file)
@@ -1729,17 +1729,11 @@ motif_drag_context_new (GdkWindow *dest_window,
   context->protocol = GDK_DRAG_PROTO_MOTIF;
   context->is_source = FALSE;
 
-  context->source_window = gdk_x11_window_lookup_for_display (display, source_window);
-  if (context->source_window)
-    g_object_ref (context->source_window);
-  else
+  context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
+  if (!context->source_window)
     {
-      context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
-      if (!context->source_window)
-        {
-          g_object_unref (context_x11);
-          return NULL;
-        }
+      g_object_unref (context_x11);
+      return NULL;
     }
 
   context->dest_window = dest_window;
@@ -2899,17 +2893,11 @@ xdnd_enter_filter (GdkXEvent *xev,
   device_manager = gdk_display_get_device_manager (display);
   gdk_drag_context_set_device (context, gdk_device_manager_get_client_pointer (device_manager));
 
-  context->source_window = gdk_x11_window_lookup_for_display (display, source_window);
-  if (context->source_window)
-    g_object_ref (context->source_window);
-  else
+  context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
+  if (!context->source_window)
     {
-      context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
-      if (!context->source_window)
-        {
-          g_object_unref (context);
-          return GDK_FILTER_REMOVE;
-        }
+      g_object_unref (context);
+      return GDK_FILTER_REMOVE;
     }
   context->dest_window = event->any.window;
   g_object_ref (context->dest_window);
@@ -3332,13 +3320,7 @@ gdk_x11_drag_context_find_window (GdkDragContext  *context,
                                                       &context_x11->version);
 
       if (recipient != None)
-        {
-          dest_window = gdk_x11_window_lookup_for_display (display, recipient);
-          if (dest_window)
-            g_object_ref (dest_window);
-          else
-            dest_window = gdk_x11_window_foreign_new_for_display (display, recipient);
-        }
+        dest_window = gdk_x11_window_foreign_new_for_display (display, recipient);
       else
         dest_window = NULL;
     }